#pragma once
#include "../../src_basics/dataStructAlg.h"


class _declspec(dllexport) GoldenFinger {
public:
	struct FingerPadStack {
		double sizeX;
		double sizeY;
	};

	GoldenFinger() {}

	GoldenFinger(const std::vector<Line>& OuterContour, const Line& goldLine, int direction, int orderNum) {
		this->fingerOuter = OuterContour;
		this->goldWire = goldLine;
		this->fingerOrientation = direction;
		this->tag = orderNum;
		getLengthandWidth(OuterContour);
	}

	double getRotation()const;

	double getLength(const Line& a);     //Calculate the length of a line segment
	void getLengthandWidth(const std::vector<Line>& OuterContour);  // Calculate the length and width of the golden finger 
	void setfingerOuter(const std::vector<Line>& OuterContour);     // Set the outer contour of the golden finger
	void setGoldWire(const Line& goldLine);                         // Set the gold thread of the golden finger
	void setOrientation(int direction);                      // Set the orientation of the golden finger
	void setSnapType(int snapType);                          // Set the position of the golden finger relative to the guide line
	void setShapeType(int shapeType);                        // Set the shape of the golden finger
	void setDirty(int dirtyValue);                           // Set to determine if push occurs
	void setTag(int tagValue);                               // Set the label used to establish a mapping relationship with the front-end object   

	void setFingerPadStack(const FingerPadStack& padStack);
	inline const std::vector<Line>& getFingerOuter() const { return fingerOuter; }
	inline const Line& getGoldWire() const { return goldWire; }
	inline int getOrientation() const { return fingerOrientation; }
	inline bool isDirty() const { return dirty; }
	inline int getTag() const { return tag; }




public:
	std::vector<Line> fingerOuter;  // 金手指外轮廓
	Line goldWire;                  // 金线  默认起点（Pt1）为PIN，终点（Pt2）为金手指内中心点
	int fingerOrientation = 0;      // 金手指的朝向 [1] fingerOrientation = 0: 垂直于guideline ; [2]fingerOrientation = 1: 金线方向 。 [3]fingerOrientation = 2: 垂直于diepad方向 。 默认垂直, 推挤算法内部不修改金手指的朝向。
	double fingerLength = 0;        // 金手指的长度：矩形的长度，不包括半圆。 默认是0，使用前需调用计算函数getLengthandWidth
	double fingerWidth = 0;         // 金手指的宽度
	int snapType = 0;               // 金手指相对guideline的位置 0: center of finger; 1: near end; 2: far end
	int shapeType = 0;              // 金手指的形状： [1]shapeType = 0 (default): 椭圆； [2]shapeType = 1 : 矩形
	bool dirty = false;             // 是否发生推挤
	int tag = 0;                    // 用来建立与前端对象的映射关系

	FingerPadStack fingerPadStack;

	double rotation;
};
